<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
    <!-- 个人中心 -->
    <script type="text/javascript" src="/lib/haha/core/start.js"></script>
    <script>
        if (!shared.getCookie('userinfo')) {
            location.href = '/login.html';
        }
    </script>
    <link rel="stylesheet" href="/CSS/personal_center.css">
    <link rel="stylesheet" href="/CSS/pageNation.css">
    <link rel="stylesheet" href="/CSS/base_info.css">
</head>

<body>
    <div id="header"></div>
    <!-- 内容 -->
    <div class="container flex-r-b">
        <!-- 左侧菜单 -->
        <div class="left">
            <div class="aside">
                <div class="top">
                    <!-- 个人中心 -->
                    <span>个人中心</span>
                </div>
                <!-- 分类导航栏菜单 -->
                <div class="asideMenu">
                    <ul class="box">
                        <li class="noactive">
                            <p class="five"><i></i>资源收藏</p>
                            <ul id='classifyBox'></ul>
                        </li>
                        <li class="noactive">
                            <p class="five"><i></i>资源下载</p>
                        </li>
                        <li class="noactive">
                            <p class="five"><i></i>资源预览</p>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <!-- 右侧表格 -->
        <div class="rightbox">
            <div class="tablebox">
                <!-- 搜索框 -->
                <div>
                    <div class="search flex-center">
                        <div class="searchPart flex" id="search"></div>
                    </div>
                    <!-- 表格 -->
                    <div id="mySaveTable"></div>
                </div>
                <div id='downloadTable' style="display: none;"></div>
                <div id='previewTable' style="display: none;"></div>
            </div>
        </div>

    </div>
    </div>
    <div id="footer"></div>
    <script type="text/javascript" src="/lib/layer-v3.1.1/layer/layer.js"></script>
    <script src="/lib/layui/layui.js"></script>
    <script type="text/javascript">
        $('#classifyBox').load('/shared/saveClassify.html');
        var postTableData = {
            page: 1,
            searchValue: '',
            pageSize: 10,
            collectClassifyID: ''
        };
        var callBackPage = function callBack(curr, limit) {
            postTableData.page = curr;
            //每页显示的条数
            postTableData.pageSize = limit;
        };
        function render(data, index) {
            return {
                tableName: function (data, index) {
                    return data.tableName ? data.tableName : data.outTableName;
                }
            }
        };
        $(function () {
            shared.useLayout("act-1");
            $('#downloadTable').load('/shared/downloadTable.html');
            $('#previewTable').load('/shared/previewTable.html');
            // 我的收藏 表格
            $("#mySaveTable").load("/shared/mySaveTable.html");
            core.useTemplateAuto('selectArr', config.selectPerArr, {});
            // 进入页面显示我的收藏列表
            $('.rightbox>div').each(function (index, item) {
                if (!index) {
                    $(item).css('display', 'block');
                } else {
                    $(item).css('display', 'none');
                }
            })
            $('.asideMenu .box>li').eq(0).toggleClass('active')
            $('.asideMenu .box>li').eq(0).children('p').toggleClass('inactives')
            $('.asideMenu .box>li').eq(0).children('ul').css('display', 'block');

            // 检索
            $('#searchBtn').click(function () {
                goMultiSearch();
            })
            function goMultiSearch() {
                postTableData.searchValue = $('#searchWord').val();
                postTableData.page = 1;
                pageData.tableData(config.getCollectionList, postTableData, 'mySaveTableData', 'savePageNation', true, '#mention1', render(), false, callBackPage);
            }
            $('.noactive').click(function () {
                // 其他的样式变回
                var index1 = $(".asideMenu .box>li").index($(this));
                //点击侧边栏切换
                $('.tablebox>div').each(function (index, item) {
                    if (index1 == index) {
                        $(item).show();
                    } else {
                        $(item).hide();
                    }
                })
                $('.asideMenu .box>li').each(function (index, item) {
                    $(item).removeClass('active');
                    $(item).addClass('noactive');
                    if ($(item).siblings('li').children('ul').css('display') == 'block') {
                        $(item).siblings('li').children('ul').css('display', 'none');
                    }
                    if ($(item).children('p').hasClass('inactives')) {
                        if (index1 != index) {
                            $(item).children('p').removeClass('inactives');
                            $(item).children('p').addClass('actives');
                        }
                    }
                })
                $(this).children('ul').css('display', 'block');
                $(this).toggleClass('active')
            })
            $('.noactive>ul').click(function (e) {
                e.stopPropagation()
            })
            $('.inactive').click(function () {
                if ($(this).siblings('ul').css('display') == 'none') {
                    $(this).addClass('inactives');
                    // // 切换背景样式
                    $(this).siblings('ul').slideDown(100).children('li');
                    // }
                } else {
                    // 切换背景样式
                    //控制自身变成+号
                    $(this).removeClass('inactives');
                    //控制自身菜单下子菜单隐藏
                    $(this).siblings('ul').slideUp(100);
                    //控制自身子菜单变成+号
                    //控制自身菜单下子菜单隐藏
                    $(this).siblings('ul').children('li').children('ul').slideUp(100);

                }
            })
        })
    </script>
</body>

</html>